<!doctype html>
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta name="layout" content="common">
<style>
select[name$="_month"]{
	width:auto;
}
select[name$="_year"]{
	width:auto;
}
select[name$="_day"]{
	width:auto;
}
</style>
<title>Manage Voucher</title>
</head>
<body id="body">
	<h2>Manage Voucher - Update</h2>
	<hr />
	<g:if test="${flash.message}">
		<div class="alert alert-success">
			<img src="${resource(dir:'images', file:'icon_successful.png') }" />&nbsp;&nbsp;${flash.message}
		</div>
	</g:if>
	
	<div class="row>">
		<g:form name="createvoucher" method="POST" action="update">
			<g:hiddenField name="id" value="${voucherInstance?.id}" />
			<g:hiddenField name="version" value="${voucherInstance?.version}" />
			<g:hiddenField name="prevAction" value="${prevAction}"/>
			<table width="100%">
				<tr>
					<td width="30%">Title&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="title" value="${voucherInstance.title}" maxLength="100" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="title" /></span>
					</td>
				</tr>
				<tr>
					<td>Country&nbsp;<font color="red">*</font></td>
					<td>
						<g:select name="country.id" from="${com.mastercard.labs.Country.list(sort: "name", order: "asc")}" optionKey="id" optionValue="name" value="${voucherInstance?.country?.id}" />
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="country" /></span>
					</td>
				</tr>
				<tr>
					<td>Merchant</td>
					<td>
						<g:select name="merchant.id" from="${com.mastercard.labs.Merchant.list(sort: "name", order: "asc")}" optionKey="id" optionValue="name" value="${voucherInstance.merchant?.id}" noSelection="${['':'Select One...']}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="merchant?.id" /></span>
					</td>
				</tr>
				<tr>
					<td>Categories</td>
					<td>
						<g:select name="categories" multiple="true" from="${com.mastercard.labs.Category.list(sort: "name", order: "asc")}" optionKey="id" optionValue="name" value="${voucherInstance.categories?.id}" noSelection="${['':'Select One...']}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="categories?.id" /></span>
					</td>
				</tr>
				<tr>
					<td>Start Date&nbsp;<font color="red">*</font></td>
					<td>
						<calendar:datePicker name="startDate" value="${voucherInstance.startDate}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="startDate" /></span>
					</td>
				</tr>
				<tr>
					<td>End Date&nbsp;<font color="red">*</font></td>
					<td>
						<calendar:datePicker name="endDate" value="${voucherInstance.endDate}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="endDate" /></span>
					</td>
				</tr>
				<tr>
					<td>Redemption Point&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="rdptPoint" value="${voucherInstance.rdptPoint}" maxLength="15" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="rdptPoint" /></span>
					</td>
				</tr>
				<tr>
					<td>Total Quantity&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="totalQuantity" value="${voucherInstance.totalQuantity}" maxLength="10" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="totalQuantity" /></span>
					</td>
				</tr>
				<tr>
					<td>Description</td>
					<td>
						<g:textArea name="description" value="${voucherInstance.description}" rows="5" style="resize: none; width: 220px;"></g:textArea>
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="description" /></span>
					</td>
				</tr>
				<tr>
					<td>ImageUrl</td>
					<td>
						<g:textField name="imageUrl" value="${voucherInstance.imageUrl}" maxLength="255" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${voucherInstance}" field="imageUrl" /></span>
					</td>
				</tr>
				<tr><td>&nbsp;</td></tr>
				<tr>
					<td></td>
					<td>
						<g:actionSubmit action="update" value="Save" class="btn btn-primary" />
						<g:actionSubmit action="list" value="Cancel" class="btn" onclick="return confirm('Any changes made will be lost without saving. Are you sure you want to cancel?');" />
						<!-- g:actionSubmit action="delete" value="Delete" class="btn btn-primary" /-->
					</td>
				</tr>
			</table>
		</g:form>
	</div>
</body>
</html>
